/*
 * File:   season.cpp
 * Author: dolphinigle
 *
 * Created on March 16, 2011, 2:39 PM
 */

#include <assert.h>
#include "season.hpp"

const int Season::kSeasonCount = 3;

const std::string Season::kSeasonNames[] = {
  "Semester I",
  "Semester II",
  "Semester III"
};

const std::string Season::kSeasonDescriptions[] = {
  "Semester penuh penderitaan",
  "Semester dengan penderitaan maximal",
  "Semester khusus Pak Rila"
};

const int Season::kSeasonLength[] = {
  20,
  20,
  10
};

// number of seasons
int Season::getSeasonCount() {
  return kSeasonCount;
}

// ids are 0-indexed
std::string Season::getSeasonName(int season_id) {
  return kSeasonNames[season_id];
}

// mask stores the mask of possible seasons. The least-important-bit
// represents season_id 0, and so on. (i.e., little endian)
// returns getSeasonCount() elements, the i-th element is true iff
// season_id i is possible.
std::vector<bool> Season::getPossibleSeasons(int mask) {
  assert(mask >= 0 && mask < (1 << getSeasonCount()));
  std::vector<bool> ret(getSeasonCount(), false);
  int counter = 0;
  while (mask) {
    ret[counter] = mask%2;
    mask /= 2;
    ++counter;
  }
  return ret;
}

std::string Season::getSeasonDescription(int season_id) {
  return kSeasonDescriptions[season_id];
}

int Season::getSeasonLength(int season_id) {
  return kSeasonLength[season_id];
}

